package main

import (
	"fmt"
	"time"
)

//总结：ticker.C里的逻辑会阻塞，do()方法执行完后才能执行下一个时间片里的do函数

func main() {
	ticker := time.NewTicker(time.Second * 10)
	defer ticker.Stop()
	for {
		select {
		case <-ticker.C:
			do()
		}
	}
}

func do() {
	fmt.Println(11111)
	time.Sleep(5 * time.Second)
	fmt.Println("done")
}
